import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false

import Api from './utils/Api.js'
import Apipc from "./utils/Apipc.js";
import hApi from "./utils/Apihbw.js";
import upload from "./utils/upload.js";
import {
	filePost,
	inputFunc,
	inputFunc2
} from './utils/utils.js'

Vue.prototype.$Apipc = Apipc
Vue.prototype.$hApi = hApi
Vue.prototype.$Api = Api
Vue.prototype.$upload = upload
Vue.prototype.$fileImgFunc = filePost
Vue.prototype.$inputFunc = inputFunc
Vue.prototype.$inputFunc2 = inputFunc2



// 判断字段显示
Vue.prototype.$fieldShowFunc = (field) => {
	let app = getApp();
	if (!app.globalData.fieldPermissions) return true;
	let fieldList = app.globalData.fieldPermissions.checkedList;
	// let fieldList = store.getters.fieldList.checkedList;
	return fieldList.includes(field)
}
// 拨打电话
Vue.prototype.$callPhone = (phoneNumber) => {
	uni.makePhoneCall({
		phoneNumber, // 仅为示例，请勿在实际项目中直接传递明文电话号码
		success() {},
		fail() {}
	});
}

// 菜单判断
Vue.prototype.$menuShow = (path) => {
	let app = getApp();
	let menuList = app.globalData.menuList;
	return menuList.includes(path)
}

// 操作权限判断
Vue.prototype.$isPer = (arr, valArr) => {
	if (arr.length == 0) {
		return false;
	}
	if (valArr.length == 1) {
		return arr.includes(valArr[0]);
	}
	let res = [];
	valArr.map(item => {
		if (arr.includes(item)) {
			res.push(true);
		}
	})
	return res.length != 0;
};

import uView from '@/uni_modules/uview-ui'
Vue.use(uView)

App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif